/** 色值可以参考：https://yeun.github.io/open-color/ */

@shadow: 0 0 10px rgba(128, 145, 165, 0.2);

// 亮色
@toolbarBgLight: white;
@toolbarShadowLight: @shadow;
@toolbarBtnBgLight: transparent;
@toolbarBtnColorLight: #3f4a56;
@toolbarBtnBgHoverLight: #ebf3ff;
@toolbarBtnHoverColorLight: #5d9bfc;
@toolbarBtnDisabledLight: #ccc;

/** 工具栏样式 */
@toolbarBg: @toolbarBgLight;
@toolbarBtnColor: @toolbarBtnColorLight;
@toolbarBtnBgHover: @toolbarBtnBgHoverLight;
@toolbarBtnHoverColor: @toolbarBtnHoverColorLight;
@toolbarColorItemHoverBorderColor: rgb(247, 133, 83);
@sidebarShadow: @shadow;
/** 编辑区域样式 */
@editorBg: rgb(255, 255, 255);
@editorColor: rgb(63, 74, 86);
@editorSelectedBg: @toolbarBtnBgHover;
@editorUrlBg: rgb(215, 230, 254);
@editorCursorColor: rgb(0, 0, 0);
@editorImportantColor: rgb(34, 139, 230);
@editorCodeColor: #1890ff;
/** 预览区域样式 */
@previewBg: rgb(255, 255, 255);
@previewMobileBgColor: @editorBg;
/** markdown样式 */
@mdColor: @editorColor;
@mdHeaderColor: @editorImportantColor;
@mdLineColor: rgb(25, 113, 194);
@mdAColor: @editorCodeColor;
@mdAHoverColor: @editorImportantColor;
@mdInlineCodeColor: @editorCodeColor;
@mdInlineCodeBg: @editorUrlBg;
@mdBlockquoteBg: rgb(231, 245, 255);
/** 编辑器样式 */
.cherry.theme__ant-design {
  /** 顶部按钮, 选中文字时弹出的按钮, 光标focus到空行时联想出的按钮, 侧边栏按钮 */
  .cherry-toolbar,
  .cherry-floatmenu,
  .cherry-bubble,
  .cherry-sidebar {
    background: @toolbarBg;
    border-color: @toolbarBg;
    .cherry-toolbar-button {
      color: @toolbarBtnColor;
      &:hover {
        background-color: @toolbarBtnBgHover;
        color: @toolbarBtnHoverColor !important;
        border-color: @toolbarBg;
        i {
          color: @toolbarBtnHoverColor !important;
        }
      }
    }
  }

  /** 二级菜单 */
  .cherry-dropdown {
    background: @toolbarBg;
    .cherry-dropdown-item {
      color: @toolbarBtnColor;
      // 选中子菜单高亮
      &__selected {
        background-color: @toolbarBtnBgHover;
        color: @toolbarBtnHoverColor;
      }
      &:hover {
        background-color: @toolbarBtnBgHover;
        color: @toolbarBtnHoverColor;
      }
    }
    /** 选择颜色的按钮 */
    &.cherry-color-wrap {
      /** 色盘的标题 */
      h3 {
        color: @toolbarBtnColor;
      }
      /** 色盘里的每一个色块 */
      .cherry-color-item {
        // width: 15px;
        // border: none;
        border-color: @toolbarBtnBgHover;
        &:hover {
          border-color: @toolbarColorItemHoverBorderColor;
        }
      }
    }
    /** 选择表格的按钮 */
    .cherry-insert-table-menu-item {
      border-color: @toolbarBtnBgHover;
    }
  }

  /** 选中文字时弹出的按钮 */
  .cherry-bubble {
    .cherry-bubble-bottom {
      border-top-color: @toolbarBg;
    }
    .cherry-bubble-top {
      border-bottom-color: @toolbarBg;
    }
    /** 粘贴HTML内容时弹出的选择按钮 */
    &.cherry-switch-paste {
    }
  }

  .cherry-editor {
    background-color: @editorBg;
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
    line-height: 2;
    .CodeMirror {
      background-color: @editorBg;
      .CodeMirror-cursor {
        border-left: 1px solid @editorCursorColor;
      }
      .CodeMirror-scroll {
        span,
        .cm-variable-2,
        .cm-string,
        .cm-strong,
        .cm-em,
        .cm-meta {
          color: @editorColor;
        }
        .cm-image-marker,
        .cm-quote,
        .cm-header,
        .cm-atom {
          color: @editorImportantColor;
        }
        .cm-url {
          background-color: @editorUrlBg;
        }
        .cm-comment,
        .cm-url {
          color: @editorCodeColor;
        }
      }
      .CodeMirror-selected {
        background-color: @editorSelectedBg;
      }
    }
  }

  .cherry-sidebar {
    box-shadow: @sidebarShadow;
  }

  .cherry-previewer {
    background-color: @previewBg;
    .cherry-mobile-previewer-content {
      background-color: @previewMobileBgColor;
    }
  }

  .cherry-previewer-table-content-handler {
    .cherry-previewer-table-content-handler__input {
      textarea {
        background-color: @editorBg;
        color: @editorColor;
        outline-color: @editorImportantColor;
      }
    }
  }

  .cherry-previewer-codeBlock-hover-handler {
    .cherry-code-preview-lang-select {
      border-color: #333;
      border-radius: 4px;
    }
  }
}
/** 预览区域样式 */
.cherry-markdown.theme__ant-design {
  color: @mdColor;
  background-color: @previewBg;

  p,
  div {
  }

  p,
  pre {
    margin: 1em 0;
  }

  anchor {
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.3s;
  }

  h1 {
    margin-bottom: 20px;
    color: rgba(0, 0, 0, 0.85);
    font-weight: 500;
    font-size: 30px;
    font-family:
      Avenir,
      -apple-system,
      BlinkMacSystemFont,
      segoe ui,
      Roboto,
      helvetica neue,
      Arial,
      noto sans,
      sans-serif,
      apple color emoji,
      segoe ui emoji,
      segoe ui symbol,
      noto color emoji,
      sans-serif;
    line-height: 38px;
  }

  h2 {
    font-size: 24px;
    line-height: 32px;
  }

  h2,
  h3,
  h4,
  h5,
  h6 {
    clear: both;
    margin: 1.6em 0 0.6em;
    color: rgba(0, 0, 0, 0.85);
    font-weight: 500;
    font-family:
      Avenir,
      -apple-system,
      BlinkMacSystemFont,
      segoe ui,
      Roboto,
      helvetica neue,
      Arial,
      noto sans,
      sans-serif,
      apple color emoji,
      segoe ui emoji,
      segoe ui symbol,
      noto color emoji,
      sans-serif;
  }

  h3 {
    font-size: 18px;
  }

  h4 {
    font-size: 16px;
  }

  h5 {
    font-size: 14px;
  }

  h6 {
    font-size: 12px;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    /** 标题前面的锚点或序号 */
    .anchor {
      display: inline-block;
      opacity: 1;
    }
  }

  br,
  p > br {
    clear: both;
  }

  ul {
    &.cherry-list__upper-roman {
      list-style: upper-roman;
    }

    &.cherry-list__lower-greek {
      list-style: lower-greek;
    }

    &.cherry-list__cjk-ideographic {
      list-style: cjk-ideographic;
    }

    &.cherry-list__circle {
      list-style: circle;
    }

    &.cherry-list__square {
      list-style: square;
    }

    &.cherry-list__default {
    }

    /** checklist 模式，未勾选时 */
    .ch-icon-square {
    }
    /** checklist 模式，勾选时 */
    .ch-icon-check {
    }
  }

  ol {
    li {
      margin-left: 20px;
      padding-left: 4px;
      list-style-type: decimal;
    }
  }

  ul {
    li {
      margin-left: 20px;
      padding-left: 4px;
      list-style-type: circle;
    }
  }

  ul > li > p,
  ol > li > p {
    margin: 0.2em 0;
  }

  blockquote {
    margin: 1em 0;
    padding-left: 0.8em;
    color: rgba(0, 0, 0, 0.45);
    font-size: 90%;
    border-left: 4px solid #f0f0f0;
    background: none;
    p {
      margin: 0;
    }
  }

  a {
    text-decoration: none;
    color: @mdAColor;
    &:hover {
      text-decoration: underline;
      color: @mdAHoverColor;
    }
    &[target='_blank']::after {
      display: none;
    }
  }

  strong,
  b {
    font-weight: 500;
  }

  em {
  }

  del {
  }

  sup {
  }

  sub {
  }

  hr {
    clear: both;
    height: 1px;
    margin: 56px 0;
    background: #f0f0f0;
    border: 0;
  }

  img {
    max-width: calc(100% - 32px);
  }

  p > img {
    margin: 34px 0;
    box-shadow: 0 8px 20px rgba(143, 168, 191, 0.35);
  }

  video {
    width: auto;
    max-width: 900px;
  }

  audio {
  }

  /** 
  * 代码块
  */
  pre code {
    display: block;
  }
  code {
    margin: 0 1px;
    padding: 0.2em 0.4em;
    font-size: 0.9em;
    border-radius: 3px;
    border: 1px solid #f0f0f0;
    font-family:
      sfmono-regular,
      Consolas,
      liberation mono,
      Menlo,
      Courier,
      monospace;
  }

  code:not(.hljs):not(.highlight-chroma) {
    background: #f2f4f5;
    color: rgba(0, 0, 0, 0.65);
  }

  /** 行内代码 */
  p code,
  li code {
  }

  pre {
    font-family:
      sfmono-regular,
      Consolas,
      liberation mono,
      Menlo,
      Courier,
      monospace;
    border-radius: 2px;
    background: none;
  }

  div pre {
    display: block;
    background: none;
  }

  svg,
  .language-abc path {
    fill: currentColor;
    color: rgba(0, 0, 0, 0.85);
  }

  .language-graphviz polygon {
    fill: transparent;
  }
  /** 
  * 表格
  */
  table,
  .cherry-table {
    width: 100%;
    margin: 8px 0 16px;
    direction: ltr;
    empty-cells: show;
    border: 1px solid #f0f0f0;
    border-collapse: collapse;
    border-spacing: 0;

    tr {
      color: #5c6b77;
      font-weight: 500;
      white-space: nowrap;
      background: rgba(0, 0, 0, 0.02);
    }

    th,
    td {
      padding: 16px 24px;
      text-align: left;
      border: 1px solid #f0f0f0;
    }
  }

  /** 可以理解为上下结构的音标，下部是文字，上部是对应的拼音 */
  ruby {
    /** 上部的拼音 */
    rt {
    }
  }

  /** 脚注 */
  .footnote {
    border-color: @mdLineColor;
    .footnote-title {
      background-color: @mdInlineCodeBg;
    }
    .one-footnote {
      color: @mdColor;
      border-color: @mdLineColor;
      a.footnote-ref {
        padding: 5px;
      }
    }
  }

  /** 行间公式 */
  .Cherry-InlineMath {
  }

  /** 段落公式 */
  .Cherry-Math {
  }

  /** 目录 */
  .toc {
    .toc-title {
    }
    .toc-li {
      .level-1 {
      }
      .level-2 {
      }
      .level-3 {
      }
      a {
        &:hover {
        }
      }
    }
  }
}
